/**
 * 
 */
package dms.dto;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

import dms.model.Building;
import dms.model.form.ProcessStatus;

/**
 * @author lrz
 *
 */
public class NoticeDTO extends ActionForm {

	private Long id;	
	private String subtitle;
	private String description;
	private String building;	
	private String person;
	private String query;
	private String fromDate;
	private String toDate;
	
	
	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}
	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}
	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}
	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}
	/**
	 * @return the building
	 */
	public String getBuilding() {
		return building;
	}
	/**
	 * @param building the building to set
	 */
	public void setBuilding(String building) {
		this.building = building;
	}
	/**
	 * @return the lostPerson
	 */
	public String getPerson() {
		return person;
	}
	public void setPerson(String person) {
		this.person = person;
	}
	public String getSubtitle() {
		return subtitle;
	}
	public void setSubtitle(String subtitle) {
		this.subtitle = subtitle;
	}
	
	public String getQuery() {
		return query;
	}
	public void setQuery(String query) {
		this.query = query;
	}
	public String getFromDate() {
		return fromDate;
	}
	public void setFromDate(String fromDate) {
		this.fromDate = fromDate;
	}
	public String getToDate() {
		return toDate;
	}
	public void setToDate(String toDate) {
		this.toDate = toDate;
	}
	@Override
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {
		ActionErrors errors = new ActionErrors();
		
		if (this.subtitle == null || this.subtitle.length() == 0) {
			errors.add("subtitle", new ActionMessage("缺少副标题", false));
		}
		if (this.description == null || this.description.length() == 0) {
			errors.add("description", new ActionMessage("缺少内容", false));
		}
		if (this.person == null || this.person.length() == 0) {
			errors.add("person", new ActionMessage("缺少发布人", false));
		}
		return errors;
	}
	
	@Override
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		this.building = null;
		this.description = null;
		this.id = null;
		this.person = null;
		this.subtitle = null;
		this.query = null;
		this.fromDate = null;
		this.toDate = null;
	}
	
}
